package com.ziyun.pop.web.modules.order.controller;

import com.ziyun.pop.common.utils.UserUtils;
import com.ziyun.pop.modules.order.service.OrderItemService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 订单详情表
 *
 * @author gaosheng
 * @email
 * @date 2018-08-07 15:31:52
 */
@RestController
@RequestMapping("order/orderitem")
public class OrderItemController {
    @Autowired
    private OrderItemService orderItemService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("order:orderitem:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderItemService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 信息
     *//*
    @RequestMapping("/info/{itemId}")
    @RequiresPermissions("order:orderitem:info")
    public R info(@PathVariable("itemId") Integer itemId){
        OrderItemEntity orderItem = orderItemService.selectById(itemId);

        return R.ok().put("orderItem", orderItem);
    }

    *//**
     * 保存
     *//*
    @RequestMapping("/save")
    @RequiresPermissions("order:orderitem:save")
    public R save(@RequestBody OrderItemEntity orderItem){
        orderItemService.insert(orderItem);

        return R.ok();
    }

    *//**
     * 修改
     *//*
    @RequestMapping("/update")
    @RequiresPermissions("order:orderitem:update")
    public R update(@RequestBody OrderItemEntity orderItem){
        ValidatorUtils.validateEntity(orderItem);
        orderItemService.updateAllColumnById(orderItem);//全部更新
        
        return R.ok();
    }

    *//**
     * 删除
     *//*
    @RequestMapping("/delete")
    @RequiresPermissions("order:orderitem:delete")
    public R delete(@RequestBody Integer[] itemIds){
        orderItemService.deleteBatchIds(Arrays.asList(itemIds));

        return R.ok();
    }*/

}
